<% //macro paginate currentPage totalPage actionUrl urlParas=""%>
	<%
	if (totalPage <= 0 || currentPage > totalPage) 
		return; 
	var startPage = currentPage - 4;
	if(startPage<1){
		startPage=1;
	}
	var endPage = currentPage+4;
	if(endPage>totalPage){
		endPage = totalPage;
	}
	%>

	<nav>
	<ul class="pagination">
			<%
			if(currentPage<=8){
				startPage = 1;
			}
			if(totalPage-currentPage<8){
				endPage = totalPage;
			}
			if(currentPage==1){			
			%>
			 <li><a class="page-first disabled_page">首页</a></li>
			<li><a class="page-prev disabled_page">上页</a></li>
			<%}else{%>
			<li><a class="page-first" href="${actionUrl}?p=1${urlParas!}">首页</a></li>
			<li><a href="${actionUrl}?p=${currentPage - 1}${urlParas!}" class="page-first">上页</a></li>
			<%}%>
			
			<%
			var index = startPage;	
			while(index<=endPage){%>
			
			    <%if(currentPage == index){%>
			    <%if(1< index){%>
			 <li><a href="${actionUrl}?p=${index-1}${urlParas!}">${index-1}</a></li>
			<%}%>
					<li><a  class="active">${index}</a></li>
					<%if(totalPage> index){%>
				 <li><a href="${actionUrl}?p=${index+1}${urlParas!}">${index+1}</a></li>
				<%}%>
				<%}else{%>
					<!-- <li><a href="${actionUrl}?p=${index}${urlParas!}">${index}</a></li> -->
				<%}%>				
				
			<%
			index= index+1;
			}%>
			
			
			<%if((totalPage - currentPage) >= 8){%>
				 <!--  <li><a href="${actionUrl}?p=${totalPage - 1}${urlParas!}">${totalPage - 1}</a></li>
				<li><a href="${actionUrl}?p=${totalPage}${urlParas!}">${totalPage}</a></li> -->
			<%}%>
			
			<%if(currentPage == totalPage){%>
				<li><a class="page-next disabled_page">下页</a></li>
				<li><a class="page-last disabled_page">尾页</a></li>
			<%}else{%>
				<li><a href="${actionUrl}?p=${currentPage + 1}${urlParas!}" class="page-next" rel="next">下页</a></li>
				<li><a class="page-last" href="${actionUrl}?p=${totalPage}${urlParas!}">尾页</a></li>
			<%}%>
			
	</ul>
</nav>